package com.zm.modules.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zm.common.api.vo.Result;
import com.zm.modules.system.entity.SysUser;
import com.zm.modules.system.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @version 1.0
 * @ ClassName SysUserController
 * <p> 用户控制层
 * @ author JIMMY
 * @ Date 2020/11/11 0011 下午 11:15
 */
@RestController
@RequestMapping("sys/user")
//https://blog.csdn.net/weixin_45848110/article/details/107015219
public class SysUserController {

    @Autowired
    private ISysUserService sysUserService;

    @RequestMapping("selectUserPage")
    public Result list() {
        Result result = Result.ok("成功");
        Page page = new Page(2,2);
        Page<SysUser> sysUserPage= sysUserService.selectUserPage(page,"1");
        result.setResult(sysUserPage);
        return result;
    }

    @ApiOperation(value = "查询分类")
    @RequestMapping("listbycategory")
    public Result listByCategory(){
        Result result = Result.ok("成功");
        Page<SysUser> sysUserPage= sysUserService.listSelectUserPage();
        result.setResult(sysUserPage);
        return result;
    }
}
